package dongshi.daddy.facade;

import java.util.ArrayList;
import java.util.List;

public class KitchenOnOff implements OnOff {
    private String area = "厨房";
    // 厕所所有的灯
    private List<Lamp> lampList = new ArrayList() {
        {
            // 所有的灯默认关闭
            add(new Lamp(OnOff.ON_OFF_OFF, area + "1号灯"));
            add(new Lamp(OnOff.ON_OFF_OFF, area + "2号灯"));
        }
    };
    @Override
    public void on() {
        System.out.println("打开" + area + "所有灯开始！");
        lampList.stream().forEach(o -> o.setOnOff(OnOff.ON_OFF_ON));
        System.out.println("打开" + area + "所有灯结束！");
    }

    @Override
    public void off() {
        System.out.println("关闭" + area + "所有灯开始！");
        lampList.stream().forEach(o -> o.setOnOff(OnOff.ON_OFF_OFF));
        System.out.println("关闭" + area + "所有灯结束！");
    }
}
